#include<stdio.h>
int main(){
	char a[10005];
	char b[10005];
	scanf("%s %s",a,b);
	for(int i=0;i>=0;i++){
	if(a[i]<b[i]){
		printf("YES");
		break;}
		if(a[i]>b[i]){
		printf("NO");
		break;}}
	return 0;
}
